.\" $Header$
.nr yr \n(yr+1900
.af mo 01
.af dy 01
.TH ncmpidiff 1 "PnetCDF PNETCDF_RELEASE_VERSION" "Printed: \n(yr-\n(mo-\n(dy" "PnetCDF utilities"
.SH NAME
ncmpidiff \- compares two netCDF files in parallel
.SH SYNOPSIS
.ft B
.HP
mpiexec -n np ncmpidiff
.nh
\%[-b]
\%[-q]
\%[-h]
\%[-v var1,...,varn]
\%[-t diff,ratio]
\%\fIfile1 file2\fP
.hy
.ft
.SH DESCRIPTION
\fBncmpidiff\fP runs in parallel on np number of MPI processes to compare the
contents of the two files and reports the first difference to the standard
output.

For variables and attributes, it reports the array indices of the first
element found different when option \fB-t\fP is not used. When option \fB-t\fP
is used, it reports the element with the largest difference that fails to meet
the tolerance requirements.

If neither argument -v nor -h is given besides the two file names, the entire
files are compared.

When comparing two files entirely, the difference between \fBncmpidiff\fP and the
Unix command \fBdiff\fP is that \fBncmpidiff\fP skips the gaps between variables. The
gaps may occur when the alignment feature is used to create a new file. This
alignment allows to allocate a larger space for the file header and align the
starting file offsets of fixed-size variables (see API \fBncmpi__enddef\fP and
\fBPnetCDF hints\fP). Oftentimes, the contents of gaps are non-zero arbitrary
bytes. Thus, two netCDF files (of same or different sizes) can be reported
identical by \fBncmpidiff\fP but not by \fBdiff\fP.

.SH OPTIONS
.IP "\fB-b\fP"
Verbose mode - print results (same or different) for all components (file,
header, or variables) in comparison
.IP "\fB-q\fP"
Quiet mode - print nothing on the command-line output. This also disables
verbose mode. When in quiet mode, users should check exit status. See below in
"EXIT STATUS".
.IP "\fB-h\fP"
Compare file header only
.IP "\fB-v\fP var1,...,varn"
Compare only the given list of variables (names separated by comma without
space).
.IP "\fB-t\fP diff,ratio"
Compare variables element-wisely with tolerance (diff and ratio separated by
comma without space).  \fIdiff\fP is the absolute value of element-wise
difference of  two variables with the same name but stored in the two input
files.  \fIratio\fP is the relative element-wise difference ratio defined as
|x - y|/max(|x|, |y|), where x is an array element from a variable in the first
file and y is the corresponding array element of the same variable in the
second file. |x| represents the absolute value of x. Note when this option is
used, the output reports only the first array element that fails to meet both
tolerance requirements.

.SH EXIT STATUS
An exit status of 0 means no differences were found, and 1 means some
differences were found.  Note on VMS-based system, the exit status values are
reversed.
.SH "SEE ALSO"
.LP
.BR ncmpidump (1),
.BR cdfdiff (1),
.BR diff (1),
.BR pnetcdf (3)
.SH DATE
PNETCDF_RELEASE_DATE
.LP

